#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

infile = open("D:/data/magento/localhost1.sql", "rb")

count = 1

outfile = open("D:/data/magento/sql" + str(count) + ".sql", "wb")

for line in infile:
    line = line.rstrip()
    if line.startswith("USE `"):
        outfile.close()
        count += 1
        outfile = open("D:/data/magento/sql" + str(count) + ".sql", "wb")
    outfile.write(line + "\n")
    outfile.flush()
outfile.close()






